package com.dubbodemo.provider;

import java.io.IOException;

import com.dubbodemo.api.DemoService;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ProviderTestMain {


  @Test
  public void testConsumer() {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
        new String[]{"provider.xml"});
    context.start();
    System.out.println("consumer start");
    DemoService demoService = (DemoService) context.getBean("demoService");
    System.out.println("consumer");
    System.out.println(demoService.getPermissions(1L));
  }

  public static void main(String[] args) throws IOException {
      ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
          new String[]{"provider.xml"});
      context.start();
      System.out.println("服务提供者正在提供服务接口\n按任意键结束进程");
      DemoService demoService = (DemoService) context.getBean("demoService");
      System.out.println(demoService.getPermissions(1L));
      System.out.println("consumer start");
      System.in.read();

  }

}